<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			/**
			 * @param {number[][]} matrix
			 * @return {void} Do not return anything, modify matrix in-place instead.
			 */
			//输入：matrix = [[1,1,1],[1,0,1],[1,1,1]]
			//输出：[[1,0,1],[0,0,0],[1,0,1]]
			let row = {},
				colums = {};
			var setZeroes = function(matrix) {
				for (let i = 0; i <= matrix.length - 1; i++) {
					for (let j = 0; j <= matrix[i].length - 1; j++) {
						if (matrix[i][j] == 0) {
							row[i] = true
							colums[j] = true
						}
					}
				}
				for (let i = 0; i <= matrix.length - 1; i++) {
					for (let j = 0; j <= matrix[i].length - 1; j++) {
						if (row[i] || colums[j]) {
							matrix[i][j] = 0
						}
					}
				}
				return matrix;
			};
			console.log(setZeroes([[1,1,1],[1,0,1],[1,1,1]]));
		</script>
	</body>
</html>
